import threading
import time

class AsyncWrite(threading.Thread):
	def __init__(self, text, out):
		threading.Thread.__init__(self)
		self.text = text
		self.out = out
		
	def run(self):
		f = open(self.out, 'a')
		f.write(self.text)
		f.close()
		time.sleep(2)
		print "Finished writing the file"
		
def main():
	message = raw_input("-> ")
	bck = AsyncWrite(message, '/home/lutecia/out.txt')
	bck.start()
	bck.join()
	print "Main completed"

if __name__ == '__main__':
	main()
	